<!DOCTYPE html>
<html>
<head>
	<!-- 公共页面 -->
	#include("../include/common.html")
	<!-- 公共页面 /-->
</head>
<body class="hold-transition skin-purple sidebar-mini">
    <div class="wrapper">
        <!-- 页面头部 -->
        #include("../include/header.html")
        <!-- 页面头部 /-->
        <!-- 导航侧栏 -->
        #include("../include/menu.html")
        <!-- 导航侧栏 /-->
        <!-- 内容区域 -->
        <div class="content-wrapper" id="contentDiv">
            <!-- 正文区域 -->
            <section class="content">
				<!-- .box-body -->
                <form id="listForm" action="#(base)/admin/guestbook" method="post">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">留言管理</h3>
                    </div>
                    <div class="box-body">
                        <!-- 数据表格 -->
                        <div class="table-box">
                            <!--工具栏-->
                            <div class="pull-left">
                                <div class="form-group form-inline">
                                    <div class="btn-group">
                                        <button type="button" class="btn btn-default disabled" id="deleteButton" url="#(base)/admin/guestbook/delete"><i class="fa fa-trash-o"></i> 删除</button>
                                        <button type="button" class="btn btn-default" id="refreshButton"><i class="fa fa-refresh"></i> 刷新</button>
                                    </div>
                                </div>
                            </div>
                            <!--工具栏/-->
                            <!--数据列表-->
                            <table id="listTable" class="table table-bordered table-striped table-hover dataTable">
                                <thead>
                                    <tr>
                                        <th width="40"><input type="checkbox" id="selectAll" /></th>
	                                    <th>ID</th>
	                                    <th>联系人</th>
	                                    <th>手机</th>
	                                    <th>留言内容</th>
	                                    <th>回复内容</th>
	                                    <th>状态</th>
	                                    <th>创建日期</th>
	                                    <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody id="listTr">
									#for(guestbook : page.list)
                                    <tr>
                                        <td><input type="checkbox" name="ids" value="#(guestbook.id)" /></td>
                                        <td>#(guestbook.id)</td>
	                                    <td>#(guestbook.contact)</td>
	                                    <td>#(guestbook.mobile)</td>
	                                    <td>#(guestbook.content)</td>
	                                    <td>#(guestbook.replyContent)</td>
	                                    <td><input type="checkbox" class="js-switch-small switchbox" #if(guestbook.status==1) checked #end data-id="#(guestbook.id)" data-url="#(base)/admin/guestbook/updateStatus"/></td>
	                                    <td>#date(guestbook.createDate,"yyyy-MM-dd HH:mm:ss")</td>
	                                    <td>
	                                    	<button type="button" class="btn bg-olive btn-xs reply" val="#(guestbook.id)">回复</button>
	                                    </td>
                                    </tr>
                                    #end
                                </tbody>
                            </table>
                            <!--数据列表/-->
                        </div>
                        <!-- 数据表格 /-->
                    </div>
                    <!-- /.box-body -->
                    <!-- .box-footer-->
                    #page(pageNumber = page.pageNumber,totalPages = page.totalPage,pattern = "")
				        #include("../include/page.html")
		            #end
                    <!-- /.box-footer-->
                </div>
                </form>
            </section>
            <!-- 正文区域 /-->
        </div>
        <!-- 内容区域 /-->
        <!-- 底部导航 -->
        #include("../include/footer.html")
        <!-- 底部导航 /-->
    </div>
    
	<!-- 回复 -->
	<div id="replyModel" class="modal" role="dialog">
		<div class="modal-dialog modal-lg">
			<div class="modal-content"></div>
		</div>
	</div>
</body>
</html>
<!---->
<script>
 $(document).ready(function() {
     // 激活导航位置
     setSidebarActive("admin-guestbook");
 });
</script>
<script type="text/javascript">
var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch-small'));
elems.forEach(function(html) {
  var switchery = new Switchery(html, { size: 'small' });
});
$(".reply").click(function(){
		var guestbookId = $(this).attr("val");
        $('#replyModel').modal({ remote: "#(base)/admin/guestbook/reply?guestbookId="+guestbookId });
    });
    $("#replyModel").on("hidden.bs.modal", function() {
        $(this).removeData("bs.modal");
    });
</script>